package com.mycompany.ui;

import java.io.File;

import javax.servlet.ServletContext;
import javax.servlet.http.HttpSession;

import org.springframework.context.ApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;

import com.mysema.query.codegen.GenericExporter;
import com.vaadin.annotations.Theme;
import com.vaadin.server.VaadinRequest;
import com.vaadin.server.WrappedHttpSession;
import com.vaadin.server.WrappedSession;
import com.vaadin.ui.UI;

@Theme("runo")
public class AppUI extends UI {
	
	private ApplicationContext applicationContext;

	@Override
	protected void init(VaadinRequest request) {
		
		
		
		setContent(new MyLayout());
		getPage().setTitle("Vaadin and Spring");
		
		WrappedSession session = request.getWrappedSession();
		HttpSession httpSession = ((WrappedHttpSession)
		session).getHttpSession();
		ServletContext servletContext =
		httpSession.getServletContext();
		applicationContext = WebApplicationContextUtils.
		getRequiredWebApplicationContext(servletContext);
		
	}
	
	public ApplicationContext getApplicationContext() {
		return applicationContext;
		}
	
	
	
	
	
	
	
	
	
}